<template>
  <div class="home">
    <div class="shoplist">
      <div @click="toDetail(item)" class="shop" v-for="(item,index) in shoplist" :key="index">
        <div class="imgbox">
          <img :src="item.picUrl" alt="">
        </div>
        <div class="text">
          <span>{{item.name}}</span>
          <span> ☆ {{item.wmPoiScore/10}} {{item.monthSalesTip}}</span>
          <span>{{item.minPriceTip}} {{item.shippingFeeTip}}</span>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import { shop_list } from '../../utils/api'

export default {
  data(){
    return {
      shoplist:[]
    }
  },
  mounted(){
    shop_list().then((res)=>{
      this.shoplist = res.data.list
    })
  },
  methods:{
    toDetail(item){ 
      this.$router.push('/detail/'+item.mtWmPoiId);
    }
  }
}
</script>

<style lang='scss' scoped>
.shoplist{
  margin: 4vw;
  .shop{
    display: flex;
    margin: 4vw 0;
    .imgbox{
      width: 20vw;
      margin-right: 5vw;
      img{
        width: 100%;
      }
    }
    .text{
      font-size: 4vw;
      span{
        display: block;
      }
    }
  }
}
</style>